#ifndef __MAIN_SCENE_MIDDLE_H__
#define __MAIN_SCENE_MIDDLE_H__
#include "cocos2d.h"
#include "MailLayer.h"
#include "Card_LevelupLayer.h"
#include "PlayerCardListLayer.h"
#include "PlayerCard.h"
#include "Player_AddCardToTeamLayer.h"
#include "MessageBoxLayer.h"
#include "PlayerRewardLayer.h"
USING_NS_CC;


enum MiddleScene_UIs
{
	MAIN_UI,
	CARD_UI,
	SALE_UI,
	EVOLVEE_UI,
	CHIP_UI,
	LEVELUP_UI,
	TASK_UI,
	COLLEAGE_UI,
	MAIL_UI,
	CHANGECARD_UI,
};



class MainSceneMiddle : public CCLayer
{
public:
	MainSceneMiddle();
	~MainSceneMiddle();

	CREATE_FUNC(MainSceneMiddle);
	virtual bool init();
	static MainSceneMiddle* GetInstance();
	void RestoreToMiddleUI();
	void Configure_TeamUI();
	void Configure_MainUI();
	MiddleScene_UIs GetCurUI() { return m_MiddleScene_UIs; }
	MessageBoxLayer* _MessageBoxLayer;
private:
	void AddCardWithImageToSet(int i,PlayerCard* card = nullptr);
	void Return_Callback(CCObject* pSender);
	void Mail_Callback(CCObject* pSender);
	void Card_Callback(CCObject* pSender);
	void Card_Levelup_Callback(CCObject* pSender);
	void Card_Evolve_Callback(CCObject* pSender);
	void Chip_Callback(CCObject* pSender);
	void Task_Callback(CCObject* pSender);
	void Colloage_Callback(CCObject* pSender);


	void ReSetAllUI();

	void onTouchEnded_0(CCObject* pSender);
	void onTouchEnded_1(CCObject* pSender);
	void onTouchEnded_2(CCObject* pSender);
	void onTouchEnded_3(CCObject* pSender);
	void onTouchEnded_4(CCObject* pSender);
	void Configure_MailUI();
	void Configure_CardUI();
	void Configure_Card_EvolveUI();
	void Configure_ChipUI();
	void Configure_CardLevelUpUI();
	void Configure_TaskUI();
	void Configure_ColloageUI();

	
	void TextLevel_Flash(float dt);

	void WhenTouchLeaderImage(CCObject* pObject);

private:
	CardLevelupLayer* _CardLevelupLayer;
	MailLayer* _MailLayer;
	PlayerCardListLayer* _PlayerCardListLayer;
	MiddleScene_UIs m_MiddleScene_UIs;
	CCSprite* m_TeamCCsprite;
	CCNode* m_Menu;
	AddCardListLayer* _AddCardListLayer;
	PlayerRewardLayer* _PlayerRewardLayer;


	std::vector<EventListenerTouchOneByOne*> _EventListenerTouchOneByOne;
	EventListenerTouchOneByOne* _EventListenerTouchOneByOne_[5];
	CCSize VisableSize;
	CCSprite* Text_Max[5];
	CCNode* Text_Level[5];
	CCSprite* Team_Card_Slot_Normal[5];
	CCSprite* Team_Card_Slot_Selected[5];
	CCSprite* Team_Card_Slot_Disabled[5];
	CCMenuItemSprite* Team_Card_Slot_Item[5];
	CCMenu* Team_Card_Slot_Menu[5];
	CCSprite* Captain_Frame[5];
	CCSprite* Icon_BackGround[5];
};





#endif